<!--
 * @Description: 档案页面
-->
<template>
  <BaseMainSlot :show-tab="true" :show-btn-box="true" :show-getTableDataList-box="false">
    <template v-slot:tab-select>
      <SelectButton :buttonselectlist="buttonselectlist" @nowselectbuttonindex="batchstaumet" />
    </template>
    <template v-slot:btn-box>
      <ActionBar :page-no="243" :add-active="addActive" :del-active="delActive" :edit-active="editActive"
        :has-edit="errorPEdit" :has-add="errorPAdd" :has-save="false" :has-del="false" :cancel-active="cancelActive"
        :save-active="saveActive" @edit="nowbatchstauName === '配种&投放预警配置' ? saveTupp('edit') : errorPaEdit()"
        @add="nowbatchstauName === '配种&投放预警配置' ? saveTupp('add') : add()" @cancel="cancel('formData')" @del="del"
        @save="save('formData')" />
    </template>
    <template v-slot:search-box>
      <SearchBox @search="getTableDataList()">
        <div class="common-getTableDataList-item">
          <div class="label"></div>
          <div class="input">
            <!-- <el-input v-model="name" /> -->
            <el-select v-model="organizationObj" value-key="organizationNo" filterable clearable class="selcect-one"
              @change="getTableDataList()">
              <el-option v-for="(comitem, comindex) in organizationList" :key="comindex" :value="comitem"
                :label="comitem.organizationName" />
            </el-select>
          </div>
        </div>
      </SearchBox>
    </template>
    <template v-slot:table-box>
      <div v-if="nowbatchstauName === '防疫预警配置'" class="table-main">
        <!-- 防疫预警配置 -->
        <div v-for="item in tableData" :key="item.epidemicPreventionConfigNo" class="table-main-item">
          <div class="main-item-title">
            {{ item.sheepType }}({{ item.gender }})
            <i></i>
          </div>
          <div v-if="item.timeType === '天数'" class="main-item-mas">
            <div v-if="item.epidemicConfigMapperList">
              <div v-for="itemep, index in item.epidemicConfigMapperList"
                :key="itemep.epidemicPreventionConfigNo + index">{{ itemep.condition }} {{ itemep.day }}天 {{
                  itemep.epidemicType }} {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '日期'" class="main-item-mas">
            <div v-if="item.epidemicConfigMapperList">
              <div v-for="itemep, index in item.epidemicConfigMapperList"
                :key="itemep.epidemicPreventionConfigNo + index">{{ itemep.condition }} {{ itemep.time }} {{
                  itemep.epidemicType }} {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '日龄'" class="main-item-mas">
            <div v-if="item.epidemicConfigMapperList">
              <div v-for="itemep, index in item.epidemicConfigMapperList"
                :key="itemep.epidemicPreventionConfigNo + index">{{ itemep.condition }} {{ itemep.day }} 天 {{
                  itemep.epidemicType }} {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '周期'" class="main-item-mas">
            <div v-if="item.epidemicConfigMapperList">
              <div v-for="itemep, index in item.epidemicConfigMapperList"
                :key="itemep.epidemicPreventionConfigNo + index">{{ itemep.condition }} {{ itemep.cycle }} {{
                  itemep.cycleUnit === 0 ? '年' : itemep.cycleUnit === 1 ? '月' : itemep.cycleUnit === 1 ? '日' : '' }} {{
    itemep.epidemicType }} {{ itemep.materialName }}</div>
            </div>
          </div>
          <el-button v-if="judgePermission(243, 'edit')" type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button v-else-if="!judgePermission(243, 'edit')" disabled type="text" class="editable">修改</el-button>
          <el-button v-if="judgePermission(243, 'delete')" type="text" class="deletable"
            @click="handleDelete(item.epidemicPreventionConfigNo)">删除</el-button>
          <el-button v-else-if="!judgePermission(243, 'delete')" disabled type="text" class="deletable">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '驱虫预警配置'" class="table-main">
        <!-- 驱虫预警配置 -->
        <div v-for="item in tableData" :key="item.dewormingWarnConfigNo" class="table-main-item">
          <div class="main-item-title">
            {{ item.sheepType }}({{ item.gender }})
            <i></i>
          </div>
          <div v-if="item.timeType === '天数'" class="main-item-mas">
            <div v-if="item.dewormingConfigMapperList">
              <div v-for="itemep, index in item.dewormingConfigMapperList" :key="itemep.dewormingWarnConfigNo + index">{{
                item.dewormType }} {{ itemep.condition }} {{ itemep.day }}天 {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '日期'" class="main-item-mas">
            <div v-if="item.dewormingConfigMapperList">
              <div v-for="itemep, index in item.dewormingConfigMapperList" :key="itemep.dewormingWarnConfigNo + index">{{
                item.dewormType }} {{ itemep.condition }} {{ itemep.time }} {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '日龄'" class="main-item-mas">
            <div v-if="item.dewormingConfigMapperList">
              <div v-for="itemep, index in item.dewormingConfigMapperList" :key="itemep.dewormingWarnConfigNo + index">{{
                item.dewormType }} {{ itemep.condition }} {{ itemep.day }} 天 {{ itemep.materialName }}</div>
            </div>
          </div>
          <div v-if="item.timeType === '周期'" class="main-item-mas">
            <div v-if="item.dewormingConfigMapperList">
              <div v-for="itemep, index in item.dewormingConfigMapperList" :key="itemep.dewormingWarnConfigNo + index">
                {{ item.dewormType }}
                {{ itemep.condition }} {{ itemep.cycle }} {{ itemep.cycleUnit === 0 ? '年' : itemep.cycleUnit === 1 ? '月' :
                  itemep.cycleUnit === 1 ? '日' : '' }} {{ itemep.materialName }}
              </div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" @click="handleDelete(item.dewormingWarnConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '饲料预警配置'" class="table-main">
        <!-- 饲料预警配置 -->
        <div v-for="item in tableData" :key="item.feedChangeWarningConfigNo" class="table-main-item">
          <div class="main-item-title">
            {{ item.sheepType }}({{ item.gender }})
            <i></i>
          </div>
          <div v-if="item.timeType === '天数'" class="main-item-mas">
            <div v-if="item.feedChangeConfigMapperList">
              <div v-for="itemep, index in item.feedChangeConfigMapperList"
                :key="itemep.feedChangeWarningConfigNo + index">{{ item.dewormType }} {{ itemep.condition }} {{ itemep.day
                }}天 提醒</div>
            </div>
          </div>
          <div v-if="item.timeType === '日龄'" class="main-item-mas">
            <div v-if="item.feedChangeConfigMapperList">
              <div v-for="itemep, index in item.feedChangeConfigMapperList"
                :key="itemep.feedChangeWarningConfigNo + index">{{ item.dewormType }} {{ itemep.condition }} {{ itemep.day
                }} 天 提醒</div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" @click="handleDelete(item.dewormingWarnConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '妊检预警配置'" class="table-main">
        <!--
        妊检预警配置-->
        <div v-for="item in tableData" :key="item.breedWarningConfigNo" class="table-main-item">
          <div class="main-item-mas">
            <div>
              <div>配种后初检提醒天数: {{ item.checkDay }} 天</div>
              <div>是否复检: {{ item.recheckFlag ? '是' : '否' }}</div>
              <div>
                <span v-if="item.recheckFlag">初检后复检提示天数: {{ item.recheckDay }} 天</span>
              </div>
              <div>结束条件(公羊投放): {{ item.release }} 天</div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" style="color:red;margin-left: 10px;text-decoration:underline;"
            @click="handleDelete(item.breedWarningConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '产羔预警配置'" class="table-main">
        <!-- 产羔预警配置 -->
        <div v-for="item in tableData" :key="item.lambWarningConfigNo" class="table-main-item">
          <div class="main-item-mas">
            <div>
              <div>配种后产羔提醒天数: {{ item.startDay }} 天</div>
              <div>配种后产羔结束提醒天数: {{ item.endDay }} 天</div>
              <div>配种后产羔最小间隔: {{ item.interval }} 天</div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" @click="handleDelete(item.lambWarningConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '断奶预警配置'" class="table-main">
        <!-- 断奶预警配置 -->
        <div v-for="item in tableData" :key="item.weaningWarningConfigNo" class="table-main-item">
          <div class="main-item-mas">
            <div>
              <div>羔羊出生后断奶提醒天数: {{ item.checkDay }} 天</div>
              <div>结束条件(断奶提醒): {{ item.checkEndDay }} 天</div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" @click="handleDelete(item.weaningWarningConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '测定预警配置'" class="table-main">
        <!-- 测定预警配置 -->
        <div v-for="item in tableData" :key="item.measureWarningConfigNo" class="table-main-item">
          <div class="main-item-title">
            {{ item.sheepType }}({{ item.gender }})
            <i></i>
          </div>
          <div class="main-item-mas">
            <div>
              <div>{{ item.measureTypeName }} 开始 {{ item.month }}月龄-结束{{ item.unDisplayMonth }}月龄</div>
            </div>
          </div>
          <el-button type="text" class="editable" @click="() => {
            formData = item;
            edit()
          }">修改</el-button>
          <el-button type="text" class="deletable" @click="handleDelete(item.measureWarningConfigNo)">删除</el-button>
        </div>
      </div>
      <div v-if="nowbatchstauName === '配种&投放预警配置'" class="table-main errorP">
        <el-form v-if="nowbatchstauName === '配种&投放预警配置'" ref="formDatas" label-position="left" :model="formData"
          :rules="rule" class="el-form1">
          <el-divider content-position="left">配种</el-divider>

          <el-form-item label="产生条件(产后):" prop="postpartum" class="w100p"
            :rules="[{ required: true, message: '产生条件:产后XX天', trigger: 'blur' }]">
            <el-input v-model="formData.postpartum" placeholder="产生条件:产后XX天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
          <el-form-item label="结束条件(产后):" prop="postpartumEnd" class="w100p"
            :rules="[{ required: true, message: '结束条件:产后XX天', trigger: 'blur' }]">
            <el-input v-model="formData.postpartumEnd" placeholder="产后XX天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
          <el-form-item label="产生条件(流产后):" prop="abort" class="w100p"
            :rules="[{ required: true, message: '产生条件:流产后x天', trigger: 'blur' }]">
            <el-input v-model="formData.abort" placeholder="产生条件:流产后x天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
          <el-form-item label="结束条件(流产后):" prop="abortEnd" class="w100p"
            :rules="[{ required: true, message: '产生条件:流产后x天', trigger: 'blur' }]">
            <el-input v-model="formData.abortEnd" placeholder="产生条件:流产后x天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
          <el-form-item label="产生条件(后备母):" prop="reserve" class="w100p"
            :rules="[{ required: true, message: '产生条件:后备母xxx日龄', trigger: 'blur' }]">
            <el-input v-model="formData.reserve" placeholder="产生条件:后备母xxx日龄" clearable>
              <template slot="append">日龄</template>
            </el-input>
          </el-form-item>
          <el-form-item label="结束条件(后备母):" prop="reserveEnd" class="w100p"
            :rules="[{ required: true, message: '结束条件:后备母xxx日龄', trigger: 'blur' }]">
            <el-input v-model="formData.reserveEnd" placeholder="结束条件:后备母xxx日龄" clearable>
              <template slot="append">日龄</template>
            </el-input>
          </el-form-item>
          <el-form-item label="结束条件(复检):" prop="pregnancy" class="w100p"
            :rules="[{ required: true, message: '结束条件:复检xxx天', trigger: 'blur' }]">
            <el-input v-model="formData.pregnancy" placeholder="结束条件:复检xxx天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
          <el-divider content-position="left">投放</el-divider>
          <el-form-item label="结束投放条件(提醒):" prop="pregnancy" class="w100p"
            :rules="[{ required: true, message: '结束条件:提醒xxx天', trigger: 'blur' }]">
            <el-input v-model="formData.release" placeholder="结束条件:提醒xxx天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>

          <el-form-item label="结束投放条件(结束):" prop="pregnancy" class="w100p"
            :rules="[{ required: true, message: '结束条件:结束xxx天', trigger: 'blur' }]">
            <el-input v-model="formData.releaseEnd" placeholder="结束条件:结束xxx天" clearable>
              <template slot="append">天</template>
            </el-input>
          </el-form-item>
        </el-form>
      </div>
      <div v-if="nowbatchstauName === '异常参数配置'" class="table-main errorP">
        <el-form v-if="nowbatchstauName === '异常参数配置'" ref="formData" label-position="left" :model="formData" :rules="rule"
          class="el-form1">
          <el-form-item label="流产异常提醒次数/次:" prop="abortionsNumber" class="w100p"
            :rules="[{ required: true, message: '流产异常提醒次数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.abortionsNumber" placeholder="请输入流产异常提醒次数" clearable disabled />
          </el-form-item>
          <el-form-item label="育肥批次完成提醒月份/月:" prop="batchCompletionDays" class="w100p"
            :rules="[{ required: true, message: '育肥批次完成提醒月份不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.batchCompletionDays" placeholder="育肥批次完成提醒月份" clearable disabled />
          </el-form-item>
          <el-form-item :label="'羔羊断奶日龄最早异常提醒参数配置/天:'" prop="weaningDays" class="w100p"
            :rules="[{ required: true, message: '羔羊断奶日龄最早异常提醒参数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.weaningDays" :placeholder="'请输入羔羊断奶体重最早异常提醒参数配置'" clearable disabled />
          </el-form-item>
          <el-form-item :label="'羔羊断奶体重最小异常提醒参数配置/kg:'" prop="weaningWeight" class="w100p"
            :rules="[{ required: true, message: '羔羊断奶体重最小异常提醒参数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.weaningWeight" :placeholder="'请输入羔羊断奶体重最小异常提醒参数配置'" clearable disabled />
          </el-form-item>
          <el-form-item label="妊检天数最早天数/天:" prop="pregnancyDays" class="w100p"
            :rules="[{ required: true, message: '妊检天数最早天数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.pregnancyDays" placeholder="请输入妊检最早天数" clearable disabled />
          </el-form-item>
          <el-form-item label="产后进入空怀期天数/天:" prop="suckleDays" class="w100p"
            :rules="[{ required: true, message: '产后进入空怀期天数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.suckleDays" placeholder="请输入产后进入空怀期天数" clearable disabled />
          </el-form-item>
          <el-form-item label="免疫结束提醒天数:" prop="immuneEnd" class="w100p"
            :rules="[{ required: true, message: '免疫结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.immuneEnd" placeholder="免疫结束提醒天数" clearable disabled />
          </el-form-item>
          <el-form-item label="驱虫结束提醒天数:" prop="insectEnd" class="w100p"
            :rules="[{ required: true, message: '驱虫结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.insectEnd" placeholder="驱虫结束提醒天数" clearable disabled />
          </el-form-item>
          <el-form-item label="饲料变更结束提醒天数:" prop="feedEnd" class="w100p"
            :rules="[{ required: true, message: '饲料变更结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.feedEnd" placeholder="饲料变更结束提醒天数" clearable disabled />
          </el-form-item>
          <el-form-item label="分娩最早妊娠期:" prop="earlyDelivery" class="w100p"
            :rules="[{ required: true, message: '分娩最早妊娠期', trigger: 'blur' }]">
            <el-input v-model="formData.earlyDelivery" placeholder="分娩最早妊娠期" clearable disabled />
          </el-form-item>
        </el-form>
      </div>

      <!-- <Pagination
        :page-size="pageSize"
        :current-page="currentPage"
        :total-size="totalSize"
        @changePageSize="changePageSize"
        @changeCurrentPage="changeCurrentPage"
      />-->
    </template>
    <template v-slot:dialog>
      <el-dialog :title="titleText" :visible.sync="dialogFormVisible" @close="cancel('a')">
        <el-form v-if="nowbatchstauName === '妊检预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item label="配种后初检提醒天数: " prop="checkDay" class="w50p check">
            <el-input-number v-model="formData.checkDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <el-form-item v-if="formData.recheckFlag === true" label="初检后复检提示天数:" prop="recheckDay" class="w50p check">
            <el-input-number v-model="formData.recheckDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <el-form-item :label="'结束条件(公羊投放):'" prop="recheckDay" class="w50p check">
            <el-input-number v-model="formData.release" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <el-form-item label="是否复检:" prop="recheckFlag" class="w50p check">
            <el-radio-group v-model="formData.recheckFlag">
              <el-radio :label="true">是</el-radio>
              <el-radio :label="false">否</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
        <el-form v-if="nowbatchstauName === '产羔预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item label="配种后产羔提醒天数: " prop="startDay" class="w50p check">
            <el-input-number v-model="formData.startDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <el-form-item label="配种后产羔结束提醒天数:" prop="endDay" class="w50p check">
            <el-input-number v-model="formData.endDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>

          <el-form-item
            label="配种后产羔最小间隔:"
            prop="interval"
            class="w50p check"
          >
            <el-input-number
              v-model="formData.interval"
              :precision="0"
              :min="1"
              placeholder
              clearable
            />
          </el-form-item>
        </el-form>

        <el-form v-if="nowbatchstauName === '断奶预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item :label="'羔羊出生后断奶提醒天数:'" prop="checkDay" class="w50p check">
            <el-input-number v-model="formData.checkDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <el-form-item label="结束条件(断奶提醒):" prop="checkDay" class="w50p check">
            <el-input-number v-model="formData.checkEndDay" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
        </el-form>

        <el-form v-if="nowbatchstauName === '测定预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item :label="'羊只类型 : '" prop="sheepType" class="w50p">
            <el-select v-model="formData.sheepType">
              <el-option :value="'羔羊'" :label="'羔羊'" />
              <el-option :value="'育成羊'" :label="'育成羊'" />
              <el-option :value="'后备羊'" :label="'后备羊'" />
              <el-option :value="'种羊'" :label="'种羊'" />
            </el-select>
          </el-form-item>
          <el-form-item label="性别 : " prop="gender" class="w50p">
            <el-select v-model="formData.gender">
              <el-option value="全部" label="全部" />
              <el-option value="公" label="公" />
              <el-option value="母" label="母" />
            </el-select>
          </el-form-item>
          <el-form-item label="测定类型 : " prop="measureTypeNo" class="w50p">
            <el-select v-model="formData.measureTypeNo" @change="(e) => {
              let index = measList.findIndex(item => item.measureTypeNo === e)
              $set(formData, 'month', measList[index].month)
            }">
              <el-option v-for="item in measList" :key="item.measureTypeNo" :value="item.measureTypeNo"
                :label="item.measureTypeName" />
            </el-select>
          </el-form-item>
          <el-form-item label="开始月龄: " prop="month" class="w50p">
            <el-input-number v-model="formData.month" :precision="0" :min="1" placeholder clearable />
          </el-form-item>
          <!-- <el-form-item label="不预警测定类型 : " prop="measureTypeNo" class="w50p">
            <el-select
              v-model="formData.unMeasureTypeNo"
              @change="(e) => {
                let index = measList.findIndex(item => item.measureTypeNo === e)
                $set(formData, 'unDisplayMonth', measList[index].month)
              }"
            >
              <el-option
                v-for="item in measList"
                :key="item.measureTypeNo"
                :value="item.measureTypeNo"
                :label="item.measureTypeName"
              />
            </el-select>
          </el-form-item>-->
          <el-form-item label="结束月龄: " class="w50p">
            <el-input-number v-model="formData.unDisplayMonth" :precision="0" :min="1" placeholder clearable @input="() => {
              if (formData.unDisplayMonth < formData.month) {
                $set(formData, 'unDisplayMonth', formData.month)
                $message.warning('结束月龄不能小于开始月龄')
              }
            }" />
          </el-form-item>
        </el-form>

        <el-form v-if="nowbatchstauName === '防疫预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item label="	性别 : " prop="gender" class="w50p">
            <el-select v-model="formData.gender" @change="() => {
              $set(formData, 'epidemicConfigMapperList', [{}])
            }">
              <el-option value="全部" label="全部" />
              <el-option value="公" label="公" />
              <el-option value="母" label="母" />
            </el-select>
          </el-form-item>
          <el-form-item :label="'羊只类型 : '" prop="sheepType" class="w50p">
            <el-select v-model="formData.sheepType">
              <el-option :value="'羔羊'" :label="'羔羊'" />
              <el-option :value="'育成羊'" :label="'育成羊'" />
              <el-option :value="'后备羊'" :label="'后备羊'" />
              <el-option :value="'种羊'" :label="'种羊'" />
            </el-select>
          </el-form-item>
          <el-form-item label="预警条件选择: " prop="timeType" class="w50p">
            <el-select v-model="formData.timeType" @change="addCountList">
              <el-option value="天数" label="天数" />
              <el-option value="日期" label="日期" />
              <el-option value="日龄" label="日龄" />
              <el-option value="周期" label="周期" />
            </el-select>
          </el-form-item>
          <el-divider class="divider" content-position="left">
            <!-- {{ categoryTypeR(itemadd.categoryType) }} -->
          </el-divider>
          <el-form-item v-for="(produceDeta, index) in formData.epidemicConfigMapperList" :key="produceDeta.key + index"
            class="w100p">
            <div v-if="formData.timeType === '天数'" class="w100p flex-1 mr-30">
              <el-form-item label="条件选择:" :prop="'epidemicConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable>
                  <el-option :label="'断奶后'" :value="'断奶后'" />
                  <el-option v-if="formData.gender === '母'" :label="'妊娠'" :value="'妊娠'" />
                  <el-option v-if="formData.gender === '母'" :label="'产后'" :value="'产后'" />
                  <el-option :label="'配种'" :value="'配种'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'blur',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
              <el-form-item class="w30p" style="width:18%">
                <el-select v-model="produceDeta.epidemicType" placeholder="选择免疫类型" filterable clearable>
                  <el-option v-for="(item, indexs) in epidemicTypeList" :key="indexs" :label="item.name"
                    :value="item.value" />
                </el-select>
              </el-form-item>
              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.materialNo'" class="w30p" style="width:18%">
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable>
                  <el-option v-for="item in vaccinesList" :key="item.materialNo" :label="item.vaccinesName"
                    :value="item.materialNo" />
                </el-select>
              </el-form-item>
            </div>
            <div v-if="formData.timeType === '日期'" class="w100p flex-1 mr-30">
              <el-form-item label="条件选择:" :prop="'epidemicConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'每年'" :value="'每年'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.time'" :rules="{
                required: true,
                message: '日期不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-date-picker v-model="produceDeta.time" type="date" class="dates-picker" value-format="MM-dd"
                  format="MM-dd" popper-class="dates-picker" placeholder="选择日期" />
              </el-form-item>
              <el-form-item class="w30p" style="width:18%">
                <el-select v-model="produceDeta.epidemicType" placeholder="选择免疫类型" clearable filterable>
                  <el-option v-for="(item, indexs) in epidemicTypeList" :key="indexs" :label="item.name"
                    :value="item.value" />
                </el-select>
              </el-form-item>
              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.materialNo'" :rules="{
                required: true,
                message: '疫苗不能为空',
                trigger: 'change',
              }" class="w30p" style="width:18%">
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option v-for="item in vaccinesList" :key="item.materialNo" :label="item.vaccinesName"
                    :value="item.materialNo" />
                </el-select>
              </el-form-item>
            </div>
            <div v-if="formData.timeType === '日龄'" class="w100p flex-1 mr-30">
              <el-form-item label="条件选择:" :prop="'epidemicConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'日龄'" :value="'日龄'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
              <el-form-item class="w30p" style="width:18%">
                <el-select v-model="produceDeta.epidemicType" placeholder="选择免疫类型" clearable filterable>
                  <el-option v-for="(item, indexs) in epidemicTypeList" :key="indexs" :label="item.name"
                    :value="item.value" />
                </el-select>
              </el-form-item>
              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.materialNo'" :rules="{
                required: true,
                message: '疫苗不能为空',
                trigger: 'change',
              }" class="w30p" style="width:18%">
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option v-for="item in vaccinesList" :key="item.materialNo" :label="item.vaccinesName"
                    :value="item.materialNo" />
                </el-select>
              </el-form-item>
            </div>
            <div v-if="formData.timeType === '周期'" class="w100p flex-1 mr-30">
              <el-form-item label="条件选择:" :prop="'epidemicConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'周期'" :value="'周期'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.cycle'" :rules="{
                required: true,
                message: '周期不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input v-model="produceDeta.cycle" placeholder="输入周期">
                  <el-select slot="append" v-model="produceDeta.cycleUnit" placeholder="选择单位" filterable clearable>
                    <el-option :label="'年'" :value="0" />
                    <el-option :label="'月'" :value="1" />
                    <el-option :label="'日'" :value="2" />
                  </el-select>
                </el-input>
              </el-form-item>
              <el-form-item class="w30p" style="width:18%">
                <el-select v-model="produceDeta.epidemicType" placeholder="选择免疫类型" clearable filterable>
                  <el-option v-for="(item, indexs) in epidemicTypeList" :key="indexs" :label="item.name"
                    :value="item.value" />
                </el-select>
              </el-form-item>
              <el-form-item :prop="'epidemicConfigMapperList.' + index + '.materialNo'" :rules="{
                required: true,
                message: '疫苗不能为空',
                trigger: 'change',
              }" class="w30p" style="width:24%">
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option v-for="item in vaccinesList" :key="item.materialNo" :label="item.vaccinesName"
                    :value="item.materialNo" />
                </el-select>
              </el-form-item>
            </div>
            <div class="w100p addE">
              <div v-if="(nowChanceStau === 'edit')" class="line-clicks"
                @click="countList(produceDeta, produceDeta.epidemicConfigMapperId, index)">{{
                  produceDeta.epidemicConfigMapperId ? '修改' : '添加' }}</div>
              <div
                v-if="nowChanceStau === 'edit' && formData.epidemicConfigMapperList.length > 1 && produceDeta.epidemicConfigMapperId"
                class="line-clicks" @click="delProduceList(produceDeta, index)">删除</div>
              <div
                v-if="(formData.epidemicConfigMapperList.length > 1 && nowChanceStau === 'add' || (formData.epidemicConfigMapperList.length > 1 && nowChanceStau === 'edit') && !produceDeta.epidemicConfigMapperId)"
                class="line-click" @click="delCountList(index)">
                <i class="el-icon-minus"></i>
              </div>
              <div
                v-if="nowChanceStau === 'add' && index === formData.epidemicConfigMapperList.length - 1 || nowChanceStau === 'edit' && index === formData.epidemicConfigMapperList.length - 1"
                class="line-click" @click="addCountList()">
                <i class="el-icon-plus"></i>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <el-form v-if="nowbatchstauName === '驱虫预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item label="	性别 : " prop="gender" class="w50p">
            <el-select v-model="formData.gender" @change="() => {
              $set(formData, 'dewormingConfigMapperList', [])
            }">
              <el-option value="全部" label="全部" />
              <el-option value="公" label="公" />
              <el-option value="母" label="母" />
            </el-select>
          </el-form-item>
          <el-form-item :label="'羊只类型 : '" prop="sheepType" class="w50p">
            <el-select v-model="formData.sheepType">
              <el-option :value="'羔羊'" :label="'羔羊'" />
              <el-option :value="'育成羊'" :label="'育成羊'" />
              <el-option :value="'后备羊'" :label="'后备羊'" />
              <el-option :value="'种羊'" :label="'种羊'" />
            </el-select>
          </el-form-item>

          <el-form-item label="驱虫类型: " prop="dewormType" class="w50p">
            <el-select v-model="formData.dewormType">
              <el-option value="体内驱虫" label="体内驱虫" />
              <el-option value="体外驱虫" label="体外驱虫" />
            </el-select>
          </el-form-item>
          <el-form-item label="预警条件选择: " prop="timeType" class="w50p">
            <el-select v-model="formData.timeType" @change="addCountLists">
              <el-option value="天数" label="天数" />
              <el-option value="日期" label="日期" />
              <el-option value="日龄" label="日龄" />
              <el-option value="周期" label="周期" />
            </el-select>
          </el-form-item>
          <el-divider class="divider" content-position="left">
            <!-- {{ categoryTypeR(itemadd.categoryType) }} -->
          </el-divider>
          <el-form-item v-for="(produceDeta, index) in formData.dewormingConfigMapperList" :key="produceDeta.key + index"
            class="w100p">
            <div v-if="formData.timeType === '天数'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'dewormingConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'断奶后'" :value="'断奶后'" />
                  <el-option v-if="formData.gender === '母'" :label="'妊娠'" :value="'妊娠'" />
                  <el-option v-if="formData.gender === '母'" :label="'产后'" :value="'产后'" />
                  <el-option :label="'配种'" :value="'配种'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'dewormingConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
              <!-- <el-form-item
                :prop="'dewormingConfigMapperList.' + index + '.materialNo'"
                :rules="{
                  required: true,
                  message: '疫苗不能为空',
                  trigger: 'change',
                }"
                class="w30p"
              >
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option
                    v-for="item in vaccinesList"
                    :key="item.materialNo"
                    :label="item.vaccinesName"
                    :value="item.materialNo"
                  />
                </el-select>
              </el-form-item>-->
            </div>
            <div v-if="formData.timeType === '日期'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'dewormingConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'每年'" :value="'每年'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'dewormingConfigMapperList.' + index + '.time'" :rules="{
                required: true,
                message: '日期不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-date-picker v-model="produceDeta.time" type="date" class="dates-picker" value-format="MM-dd"
                  format="MM-dd" popper-class="dates-picker" placeholder="选择日期" />
              </el-form-item>
              <!-- <el-form-item
                :prop="'dewormingConfigMapperList.' + index + '.materialNo'"
                :rules="{
                  required: true,
                  message: '疫苗不能为空',
                  trigger: 'change',
                }"
                class="w30p"
              >
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option
                    v-for="item in vaccinesList"
                    :key="item.materialNo"
                    :label="item.vaccinesName"
                    :value="item.materialNo"
                  />
                </el-select>
              </el-form-item>-->
            </div>
            <div v-if="formData.timeType === '日龄'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'dewormingConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'日龄'" :value="'日龄'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'dewormingConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
              <!-- <el-form-item
                :prop="'dewormingConfigMapperList.' + index + '.materialNo'"
                :rules="{
                  required: true,
                  message: '疫苗不能为空',
                  trigger: 'change',
                }"
                class="w30p"
              >
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option
                    v-for="item in vaccinesList"
                    :key="item.materialNo"
                    :label="item.vaccinesName"
                    :value="item.materialNo"
                  />
                </el-select>
              </el-form-item>-->
            </div>
            <div v-if="formData.timeType === '周期'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'dewormingConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'周期'" :value="'周期'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'dewormingConfigMapperList.' + index + '.cycle'" :rules="{
                required: true,
                message: '周期不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input v-model="produceDeta.cycle" placeholder="输入周期">
                  <el-select slot="append" v-model="produceDeta.cycleUnit" placeholder="选择单位" filterable clearable>
                    <el-option :label="'年'" :value="0" />
                    <el-option :label="'月'" :value="1" />
                    <el-option :label="'日'" :value="2" />
                  </el-select>
                </el-input>
              </el-form-item>
              <!-- <el-form-item
                :prop="'dewormingConfigMapperList.' + index + '.materialNo'"
                :rules="{
                  required: true,
                  message: '疫苗不能为空',
                  trigger: 'change',
                }"
                class="w30p"
              >
                <el-select v-model="produceDeta.materialNo" placeholder="选择疫苗" filterable clearable>
                  <el-option
                    v-for="item in vaccinesList"
                    :key="item.materialNo"
                    :label="item.vaccinesName"
                    :value="item.materialNo"
                  />
                </el-select>
              </el-form-item>-->
            </div>
            <div class="w100p addE">
              <div v-if="(nowChanceStau === 'edit')" class="line-clicks"
                @click="countLists(produceDeta, produceDeta.dewormConfigMapperId, index)">{{
                  produceDeta.dewormConfigMapperId ? '修改' : '添加' }}</div>
              <div
                v-if="nowChanceStau === 'edit' && formData.dewormingConfigMapperList.length > 1 && produceDeta.dewormConfigMapperId"
                class="line-clicks" @click="delProduceLists(produceDeta, index)">删除</div>
              <div
                v-if="(formData.dewormingConfigMapperList.length > 1 && nowChanceStau === 'add' || (formData.dewormingConfigMapperList.length > 1 && nowChanceStau === 'edit') && !produceDeta.dewormConfigMapperId)"
                class="line-click" @click="delCountLists(index)">
                <i class="el-icon-minus"></i>
              </div>
              <div
                v-if="nowChanceStau === 'add' && index === formData.dewormingConfigMapperList.length - 1 || nowChanceStau === 'edit' && index === formData.dewormingConfigMapperList.length - 1"
                class="line-click" @click="addCountLists()">
                <i class="el-icon-plus"></i>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <el-form v-if="nowbatchstauName === '饲料预警配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form">
          <el-form-item label="	性别 : " prop="gender" class="w50p">
            <el-select v-model="formData.gender">
              <el-option value="全部" label="全部" />
              <el-option value="公" label="公" />
              <el-option value="母" label="母" />
            </el-select>
          </el-form-item>
          <el-form-item :label="'羊只类型 : '" prop="sheepType" class="w50p">
            <el-select v-model="formData.sheepType">
              <el-option :value="'羔羊'" :label="'羔羊'" />
              <el-option :value="'育成羊'" :label="'育成羊'" />
              <el-option :value="'后备羊'" :label="'后备羊'" />
              <el-option :value="'种羊'" :label="'种羊'" />
            </el-select>
          </el-form-item>
          <el-form-item label="预警条件选择: " prop="timeType" class="w50p">
            <el-select v-model="formData.timeType" @change="addfeedCountLists">
              <el-option value="天数" label="天数" />
              <el-option value="日龄" label="日龄" />
            </el-select>
          </el-form-item>
          <el-divider class="divider" content-position="left">
            <!-- {{ categoryTypeR(itemadd.categoryType) }} -->
          </el-divider>
          <el-form-item v-for="(produceDeta, index) in formData.feedChangeConfigMapperList"
            :key="(produceDeta.key || '11' + index)" class="w100p">
            <div v-if="formData.timeType === '天数'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'feedChangeConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'断奶后'" :value="'断奶后'" />
                  <el-option :label="'产后'" :value="'产后'" />
                  <el-option :label="'配种后'" :value="'配种后'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'feedChangeConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'blur',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
            </div>
            <div v-if="formData.timeType === '日龄'" class="w100p flex-1">
              <el-form-item label="条件选择:" :prop="'feedChangeConfigMapperList.' + index + '.condition'" :rules="{
                required: true,
                message: '阶段不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-select v-model="produceDeta.condition" placeholder="选择阶段" filterable clearable>
                  <el-option :label="'日龄'" :value="'日龄'" />
                </el-select>
              </el-form-item>

              <el-form-item :prop="'feedChangeConfigMapperList.' + index + '.day'" :rules="{
                required: true,
                message: '天数不能为空',
                trigger: 'change',
              }" class="w30p">
                <el-input-number v-model="produceDeta.day" :precision="0" :min="1" placeholder="输入天数" clearable />
              </el-form-item>
            </div>
            <div class="w100p addE">
              <div v-if="(nowChanceStau === 'edit')" class="line-clicks"
                @click="countfeedLists(produceDeta, produceDeta.feedChangeConfigMapperId, index)">{{
                  produceDeta.feedChangeConfigMapperId ? '修改' : '添加' }}</div>
              <div
                v-if="nowChanceStau === 'edit' && formData.feedChangeConfigMapperList.length > 1 && produceDeta.feedChangeConfigMapperId"
                class="line-clicks" @click="delfeedLists(produceDeta, index)">删除</div>
              <div
                v-if="(formData.feedChangeConfigMapperList.length > 1 && nowChanceStau === 'add' || (formData.feedChangeConfigMapperList.length > 1 && nowChanceStau === 'edit') && !produceDeta.feedChangeConfigMapperId)"
                class="line-click" @click="delfeedCountLists(index)">
                <i class="el-icon-minus"></i>
              </div>
              <div
                v-if="nowChanceStau === 'add' && index === formData.feedChangeConfigMapperList.length - 1 || nowChanceStau === 'edit' && index === formData.feedChangeConfigMapperList.length - 1"
                class="line-click" @click="addfeedCountLists()">
                <i class="el-icon-plus"></i>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <el-form v-if="nowbatchstauName === '异常参数配置'" ref="formData" label-position="left" :model="formData"
          :rules="rules" class="el-form1">
          <el-form-item label="流产异常提醒次数:" prop="abortionsNumber" class="w100p"
            :rules="[{ required: true, message: '流产异常提醒次数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.abortionsNumber" placeholder="请输入流产异常提醒次数" clearable />
          </el-form-item>
          <el-form-item label="育肥批次完成提醒月份:" prop="batchCompletionDays" class="w100p"
            :rules="[{ required: true, message: '育肥批次完成提醒月份不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.batchCompletionDays" placeholder="育肥批次完成提醒月份" clearable />
          </el-form-item>
          <el-form-item label="羔羊断奶日龄最早异常提醒参数配置:" prop="weaningDays" class="w100p"
            :rules="[{ required: true, message: '羔羊断奶日龄最早异常提醒参数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.weaningDays" placeholder="请输入羔羊断奶体重最早异常提醒参数配置" clearable />
          </el-form-item>
          <el-form-item label="羔羊断奶体重最小异常提醒参数配置:" prop="weaningWeight" class="w100p"
            :rules="[{ required: true, message: '羔羊断奶体重最小异常提醒参数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.weaningWeight" placeholder="请输入羔羊断奶体重最小异常提醒参数配置" clearable />
          </el-form-item>
          <el-form-item label="妊检天数最早天数:" prop="pregnancyDays" class="w100p"
            :rules="[{ required: true, message: '妊检天数最早天数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.pregnancyDays" placeholder="请输入母羊妊检最早天数" clearable />
          </el-form-item>

          <el-form-item label="产后进入空怀期天数/天:" prop="suckleDays" class="w100p"
            :rules="[{ required: true, message: '产后进入空怀期天数不能为空', trigger: 'blur' }]">
            <el-input v-model="formData.suckleDays" placeholder="请输入产后进入空怀期天数" clearable />
          </el-form-item>
          <el-form-item label="免疫结束提醒天数:" prop="immuneEnd" class="w100p"
            :rules="[{ required: true, message: '免疫结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.immuneEnd" placeholder="免疫结束提醒天数" clearable />
          </el-form-item>
          <el-form-item label="驱虫结束提醒天数:" prop="insectEnd" class="w100p"
            :rules="[{ required: true, message: '驱虫结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.insectEnd" placeholder="驱虫结束提醒天数" clearable />
          </el-form-item>
          <el-form-item label="饲料变更结束提醒天数:" prop="feedEnd" class="w100p"
            :rules="[{ required: true, message: '饲料变更结束提醒天数', trigger: 'blur' }]">
            <el-input v-model="formData.feedEnd" placeholder="饲料变更结束提醒天数" clearable />
          </el-form-item>
          <el-form-item label="分娩最早妊娠期:" prop="earlyDelivery" class="w100p"
            :rules="[{ required: true, message: '分娩最早妊娠期', trigger: 'blur' }]">
            <el-input v-model="formData.earlyDelivery" placeholder="分娩最早妊娠期" clearable />
          </el-form-item>
        </el-form>
        <div v-if="nowChanceStau !== ''" slot="footer" class="dialog-footer">
          <el-button class="zh-button-one" @click="cancel">取 消</el-button>
          <el-button class="zh-button-two" type="primary" @click="save('formData')">保 存</el-button>
        </div>
      </el-dialog>
    </template>
  </BaseMainSlot>
</template>

<script>
import nowpagereq from "@/api/basic-info-manage/alert-condition-configuration/alert-condition-configuration";
// import vaccinesApi from "@/api/basic-info-manage/vaccines-manage/index.js";
// import measureApi from "@/api/livestock-manage/sheep-management/measure-type.js";
import SelectButton from "./components/index.vue";

import SearchBox from "@/components/SearchBox";
import ActionBar from "@/components/ActionBar";
import BaseMainSlot from "@/components/BaseMainSlot/newBaseMainSlot.vue";
import errorPApi from "@/api/system-manage/system-parameter-table.js";
// import Pagination from "@/components/Pagination";
import { mymixin } from "@/utils/mixins";
// import MonthDays from 'month-days-element'
// import { getToken } from "@/utils/auth";
import axios from "axios";
import { mapGetters } from "vuex";
export default {
  name: "SheepFiles",
  components: {
    ActionBar,
    // Pagination,
    BaseMainSlot,
    SearchBox,
    // MonthDays,
    // StartTimeEndTimeSelectionBox,
    SelectButton
  },
  mixins: [mymixin],
  data() {
    return {
      errorPEdit: false,
      errorPAdd: true,
      name: "",
      nowbatchstau: 0,
      nowbatchstauName: "防疫预警配置",
      dataItemList: [],
      vaccinesList: [],
      buttonselectlist: [
        // { name: "防疫预警配置" },
        // { name: "驱虫预警配置" },
        // { name: "饲料预警配置" },
        { name: "妊检预警配置" },
        { name: "产羔预警配置" },
        { name: "断奶预警配置" },
        // { name: "测定预警配置" },
        { name: "配种&投放预警配置" },
        { name: "异常参数配置" }
      ],
      formDatas: {},
      epidemicTypeList: [
        {
          name: "周期免疫",
          value: "周期免疫"
        },
        {
          name: "配种前免疫",
          value: "配种前免疫"
        },
        {
          name: "后备公羊免疫",
          value: "后备公羊免疫"
        },
        {
          name: "产前免疫",
          value: "产前免疫"
        },
        {
          name: "产后免疫",
          value: "产后免疫"
        },
        {
          name: "断奶后一免",
          value: "断奶后一免"
        },
        {
          name: "断奶后二免",
          value: "断奶后二免"
        }
        // {
        //   name: "配种前免疫",
        //   value: "配种前免疫"
        // }
      ],
      epidemicTypeMList: [
        {
          name: "周期免疫",
          value: "周期免疫"
        }
      ],
      formData: { dataItemName: "" },
      measList: [],
      organizationList: [],
      organizationObj: {},
      rule: {
        checkDay: [
          {
            required: true,
            message: "配种后初检提醒天数不能为空",
            trigger: ["blur", "change"]
          }
        ],
        recheckFlag: [
          {
            required: true,
            message: "是否复检不能为空",
            trigger: ["blur", "change"]
          }
        ],
        recheckDay: [
          {
            required: true,
            message: "初检后复检提示天数不能为空",
            trigger: ["blur", "change"]
          }
        ],
        startDay: [
          {
            required: true,
            message: "配置开始天数不能为空",
            trigger: ["blur", "change"]
          }
        ],
        endDay: [
          {
            required: true,
            message: "配置结束天数不能为空",
            trigger: ["blur", "change"]
          }
        ],
        interval: [
          {
            required: true,
            message: "配种后产羔最小间隔不能为空",
            trigger: ["blur", "change"]
          }
        ],
        gender: [
          {
            required: true,
            message: "性别不能为空",
            trigger: ["blur", "change"]
          }
        ],
        sheepType: [
          {
            required: true,
            message: "羊只类型不能为空",
            trigger: ["blur", "change"]
          }
        ],
        timeType: [
          {
            required: true,
            message: "预警条件选择不能为空",
            trigger: ["blur", "change"]
          }
        ],
        dewormType: [
          {
            required: true,
            message: "驱虫类型不能为空",
            trigger: ["blur", "change"]
          }
        ],
        month: [
          {
            required: true,
            message: "开始月龄不能为空",
            trigger: ["blur", "change"]
          }
        ],
        unDisplayMonth: [
          {
            required: true,
            message: "结束月龄不能为空",
            trigger: ["blur", "change"]
          }
        ],
        measureTypeNo: [
          {
            required: true,
            message: "测定类型不能为空",
            trigger: ["blur", "change"]
          }
        ]
      }
    };
  },
  computed: {
    ...mapGetters({
      judgePermission: "permission/judgePermission",
      livestockPermission: "permission/livestockPermission"
    })
  },
  watch: {
    nowChanceStau() { }
  },
  created() {
  },
  mounted() {
    this.queryDataList();
  },
  methods: {    // 获取下拉框信息
    async queryDataList() {
      // 获取	功能仓库表达式
      const { data: res } = await axios({
        method: 'get',
        url: this.$webSerUrlPro + 'organization/organization/queryByFarmingType?farmingTypeNo=xm',
        headers: {
        },
        data: {}
      })
      this.organizationList = res.data
    },
    // 异常参数修改
    errorPaEdit() {
      this.dialogFormVisible = true;
      this.titleText = "修改";
      this.nowChanceStau = "edit";
    },
    saveTupp(e = "edit") {
      this.nowChanceStau = e;
      if (e === 'add') {
        for (let key in this.formDatas) {
          this.$set(this.formData, key, this.formDatas[key]);
        }
        this.$set(this.formData, 'breedTypeNo', 'sheep');
        this.$set(this.formData, 'organizationNo', this.organizationObj.organizationNo);

        console.log(this.formData);
        if (this.formData.organizationNo) {
          setTimeout(() => {
            // this.$refs.formDatas.resetFields();
            setTimeout(() => {
              this.save("formDatas");
            }, 200)
          }, 200)
        }

      } else {
        this.save("formDatas");
      }
    },
    // 生产批次查询
    batchstaumet(item, i) {
      this.errorPEdit = false;
      this.errorPAdd = true;
      this.nowbatchstau = i;
      this.nowbatchstauName = item.name;
      this.formData = {};
      if (item.name === "异常参数配置") {
        this.editActive = true;
        this.getErrorPData();
        if (this.formData) {
          this.addActive = false;
        }
        this.errorPEdit = true;
        this.$nextTick(() => {
          this.$refs.formData.resetFields();
        });
        return;
      }
      if (item.name === "配种&投放预警配置") {
        // this.errorPAdd = false;
        this.errorPEdit = true;
        this.editActive = true;
        this.$nextTick(() => {
          this.$refs.formDatas.resetFields();
        });

        // console.log(this.editActive)
        // return;
      }
      this.tableData = [];
      this.getTableDataList();
    },
    // 获取异常参数数据
    getErrorPData() {
      let params = {
        page: this.currentPage,
        size: this.pageSize,
        entity: {
          deviceNo: this.deviceNo,
          organizationNo: this.organizationObj.organizationNo,
          breedTypeNo: 'sheep'
        }
      }
      errorPApi.pageQuery(params, {
        databaseName: this.organizationObj?.databaseName || 'DB_TDW1_PUBLIC',
        organizationNo: this.organizationObj.organizationNo || 'COMMON',
        breedTypeNo: 'sheep'
      }).then(async res => {
        if (res.code === 1) {
          this.formData = res.data.content[0] || {};

          if (this.formData.systemParameterNo === undefined) {
            this.errorPAdd = true;
            this.addActive = true;
            this.editActive = false;
            const { data } = await errorPApi.pageQuery({}, {
              databaseName: 'DB_TDW1_PUBLIC',
              organizationNo:  'COMMON',
              breedTypeNo: 'sheep'
            })
            this.formDatas = data.content[0];
          } else {
            this.errorPAdd = false;
            this.addActive = false;
            this.editActive = true;
          }
        }
      });
    },
    startVal(e) {
      this.$set(this.searchlist, "startTime", e);
    },
    endVal(e) {
      this.$set(this.searchlist, "endTime", e);
    }, // 弹框内部list 删除
    // 防疫 ——————————————————————————————————————————
    delProduceList(e, index) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          nowpagereq.delById(e.epidemicConfigMapperId).then(res => {
            if (res.code === 1) {
              this.formData.epidemicConfigMapperList.splice(index, 1);
              this.$message.success("删除成功");
              // this.getTableDataList();
            } else {
              this.$message.error("删除失败");
            }
          });
        })
        .catch(() => {
          //
          this.$message("取消删除");
        });
    },
    // 产量详情添加修改
    countList(e, st, index) {
      let validateFieldList = [];
      this.$refs["formData"].validateField(
        [
          "epidemicConfigMapperList." + index + ".materialNo",
          "epidemicConfigMapperList." + index + ".cycle",
          "epidemicConfigMapperList." + index + ".condition",
          "epidemicConfigMapperList." + index + ".day",
          "epidemicConfigMapperList." + index + ".cycleUnit",
          "epidemicConfigMapperList." + index + ".time"
        ],
        valid => {
          if (!valid) {
            validateFieldList.push(valid);

            // 因为我这里总共校验了三个字段,所有最终三个字段都校验成功之后,数组中会有三个""
            if (
              validateFieldList.length === 3 &&
              validateFieldList.every(item => item === "" || item === undefined)
            ) {
              // 这里写校验通过的业务逻辑
              if (!st || st === undefined) {
                let addparams = {
                  ...e,
                  epidemicPreventionConfigNo: this.formData
                    .epidemicPreventionConfigNo
                };
                delete addparams.batchList;
                nowpagereq.addeqidMapper(addparams).then(async res => {
                  if (res.code === 1) {
                    this.$set(
                      this.formData,
                      "epidemicConfigMapperList",
                      await this.queryDetail(
                        this.formData.epidemicPreventionConfigNo
                      )
                    );
                    this.$message.success("添加成功");
                  } else {
                    this.$message.error("添加失败");
                  }
                });
              } else {
                let editparams = {
                  ...e
                };
                nowpagereq.editeqidMapper(editparams).then(res => {
                  if (res.code === 1) {
                    this.$message.success("修改成功");
                  } else {
                    this.$message.error("修改失败");
                  }
                });
              }
            }
            // 校验不通过走这里
            return;
          } else {
            return false;
          }
        }
      );
    }, //  查询详情
    async validateField(array) {
      let validateFieldList = [];
      this.$refs["formData"].validateField(array, valid => {
        if (!valid) {
          validateFieldList.push(valid);

          // 因为我这里总共校验了三个字段,所有最终三个字段都校验成功之后,数组中会有三个""
          if (
            validateFieldList.length === 3 &&
            validateFieldList.every(item => item === "" || item === undefined)
          ) {
            // 这里写校验通过的业务逻辑
          }
          // 校验不通过走这里
          return;
        } else {
          return false;
        }
      });
    },
    async queryDetail(e) {
      const { data: produce } = await nowpagereq.conditionepidemicConfigMapper({
        epidemicPreventionConfigNo: e
      });
      if (produce !== undefined) {
        return produce;
      } else return [];
    },
    // 添加一条清单列表
    addCountList(e) {
      // if (this.formData.epidemicPreventionConfigNo) {
      if (e) {
        this.$set(this.formData, "epidemicConfigMapperList", []);
      }
      if (
        this.formData.epidemicConfigMapperList === undefined ||
        this.formData.epidemicConfigMapperList === null
      ) {
        this.$set(this.formData, "epidemicConfigMapperList", []);
      }
      let Obj = {
        key: Date.now()
      };
      this.formData.epidemicConfigMapperList.push({ ...Obj });
      // } else {
      //   this.$message.warning("请先选择批次和鱼塘");
      // }
    },
    // 删除一条清单列表
    delCountList(index) {
      if (this.formData.epidemicConfigMapperList.length === 1) {
        return;
      } else {
        this.formData.epidemicConfigMapperList.splice(index, 1);
      }
    },
    // —————————————————————————————————
    // 驱虫++++++++++++++++++++++++++++
    // 弹框内部list 删除
    delProduceLists(e, index) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          nowpagereq.delByIds(e.dewormConfigMapperId).then(res => {
            if (res.code === 1) {
              this.formData.dewormingConfigMapperList.splice(index, 1);
              this.$message.success("删除成功");
              // this.getTableDataList();
            } else {
              this.$message.error("删除失败");
            }
          });
        })
        .catch(() => {
          //
          this.$message("取消删除");
        });
    },
    // 产量详情添加修改
    countLists(e, st, index) {
      let validateFieldList = [];
      this.$refs["formData"].validateField(
        [
          "epidemicConfigMapperList." + index + ".materialNo",
          "epidemicConfigMapperList." + index + ".cycle",
          "epidemicConfigMapperList." + index + ".condition",
          "epidemicConfigMapperList." + index + ".day",
          "epidemicConfigMapperList." + index + ".cycleUnit",
          "epidemicConfigMapperList." + index + ".time"
        ],
        valid => {
          if (!valid) {
            validateFieldList.push(valid);

            // 因为我这里总共校验了三个字段,所有最终三个字段都校验成功之后,数组中会有三个""
            if (
              validateFieldList.length === 3 &&
              validateFieldList.every(item => item === "" || item === undefined)
            ) {
              if (!st || st === undefined) {
                let addparams = {
                  ...e,
                  dewormingWarnConfigNo: this.formData.dewormingWarnConfigNo
                };
                nowpagereq.addeqidMappers(addparams).then(async res => {
                  if (res.code === 1) {
                    this.$set(
                      this.formData,
                      "dewormingConfigMapperList",
                      await this.queryDetails(
                        this.formData.dewormingWarnConfigNo
                      )
                    );
                    this.$message.success("添加成功");
                  } else {
                    this.$message.error("添加失败");
                  }
                });
              } else {
                let editparams = {
                  ...e
                };
                nowpagereq.editeqidMappers(editparams).then(res => {
                  if (res.code === 1) {
                    this.$message.success("修改成功");
                  } else {
                    this.$message.error("修改失败");
                  }
                });
              }
              // 校验不通过走这里
              return;
            } else {
              return false;
            }
          }
        }
      );
    }, //  查询详情
    async queryDetails(e) {
      const { data: produce } = await nowpagereq.conditionepidemicConfigMappers(
        {
          dewormingWarnConfigNo: e
        }
      );
      if (produce !== undefined) {
        return produce;
      } else return [];
    },
    // 添加一条清单列表
    addCountLists(e) {
      // if (this.formData.epidemicPreventionConfigNo) {
      if (e) {
        this.$set(this.formData, "dewormingConfigMapperList", []);
      }
      if (
        this.formData.dewormingConfigMapperList === undefined ||
        this.formData.dewormingConfigMapperList === null
      ) {
        this.$set(this.formData, "dewormingConfigMapperList", []);
      }
      let Obj = {
        key: Date.now()
      };
      this.formData.dewormingConfigMapperList.push({ ...Obj });
      // } else {
      //   this.$message.warning("请先选择批次和鱼塘");
      // }
    },
    // 删除一条清单列表
    delCountLists(index) {
      if (this.formData.dewormingConfigMapperList.length === 1) {
        return;
      } else {
        this.formData.dewormingConfigMapperList.splice(index, 1);
      }
    },
    // +++++++++++++++++++++++++++++++
    // 饲料++++++++++++++++++++++++++++
    // 弹框内部list 删除
    delfeedLists(e, index) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          nowpagereq.delByIds(e.feedChangeConfigMapperId).then(res => {
            if (res.code === 1) {
              this.formData.feedChangeConfigMapperList.splice(index, 1);
              this.$message.success("删除成功");
              // this.getTableDataList();
            } else {
              this.$message.error("删除失败");
            }
          });
        })
        .catch(() => {
          //
          this.$message("取消删除");
        });
    },
    // 产量详情添加修改
    countfeedLists(e, st, index) {
      let validateFieldList = [];
      this.$refs["formData"].validateField(
        [
          "epidemicConfigMapperList." + index + ".materialNo",
          "epidemicConfigMapperList." + index + ".cycle",
          "epidemicConfigMapperList." + index + ".condition",
          "epidemicConfigMapperList." + index + ".day",
          "epidemicConfigMapperList." + index + ".cycleUnit",
          "epidemicConfigMapperList." + index + ".time"
        ],
        valid => {
          if (!valid) {
            validateFieldList.push(valid);

            // 因为我这里总共校验了三个字段,所有最终三个字段都校验成功之后,数组中会有三个""
            if (
              validateFieldList.length === 6 &&
              validateFieldList.every(item => item === "" || item === undefined)
            ) {
              if (!st || st === undefined) {
                let addparams = {
                  ...e,
                  feedChangeWarningConfigNo: this.formData
                    .feedChangeWarningConfigNo
                };
                nowpagereq.addfeedMappers(addparams).then(async res => {
                  if (res.code === 1) {
                    this.$set(
                      this.formData,
                      "feedChangeConfigMapperId",
                      await this.queryfeedDetails(
                        this.formData.feedChangeWarningConfigNo
                      )
                    );
                    this.$message.success("添加成功");
                  } else {
                    this.$message.error("添加失败");
                  }
                });
              } else {
                let editparams = {
                  ...e
                };
                nowpagereq.editfeedMappers(editparams).then(res => {
                  if (res.code === 1) {
                    this.$message.success("修改成功");
                  } else {
                    this.$message.error("修改失败");
                  }
                });
              }
            }
            // 校验不通过走这里
            return;
          } else {
            return false;
          }
        }
      );
    }, //  查询详情
    async queryfeedDetails(e) {
      const { data: produce } = await nowpagereq.feedConfigMappers({
        feedChangeWarningConfigNo: e
      });
      if (produce !== undefined) {
        return produce;
      } else return [];
    },
    // 添加一条清单列表
    addfeedCountLists(e) {
      // if (this.formData.epidemicPreventionConfigNo) {
      if (e) {
        this.$set(this.formData, "feedChangeConfigMapperList", []);
      }
      if (
        this.formData.feedChangeConfigMapperList === undefined ||
        this.formData.feedChangeConfigMapperList === null
      ) {
        this.$set(this.formData, "feedChangeConfigMapperList", []);
      }
      let Obj = {
        key: Date.now()
      };
      this.formData.feedChangeConfigMapperList.push({ ...Obj });
      // } else {
      //   this.$message.warning("请先选择批次和鱼塘");
      // }
    },
    // 删除一条清单列表
    delfeedCountLists(index) {
      if (this.formData.feedChangeConfigMapperList.length === 1) {
        return;
      } else {
        this.formData.feedChangeConfigMapperList.splice(index, 1);
      }
    },
    // +++++++++++++++++++++++++++++++
    // 表格查询
    getTableDataList() {
      this.loading = true;
      let params = {
        page: this.currentPage,
        size: this.pageSize,
        entity: {
          deviceNo: this.deviceNo,
          organizationNo: this.organizationObj.organizationNo,
          breedTypeNo: 'sheep'
        }
      };
      let Api = "";
      if (this.nowbatchstauName === "防疫预警配置") {
        Api = "pageQueryeqid";
        // params["entity"].dataItemName = this.dataItemName;
      } else if (this.nowbatchstauName === "驱虫预警配置") {
        Api = "pageQuerydewo";
      } else if (this.nowbatchstauName === "饲料预警配置") {
        Api = "pageQueryfeed";
      } else if (this.nowbatchstauName === "妊检预警配置") {
        Api = "pageQuerybree";
      } else if (this.nowbatchstauName === "产羔预警配置") {
        Api = "pageQuerylamb";
      } else if (this.nowbatchstauName === "测定预警配置") {
        Api = "pageQuerymeas";
      } else if (this.nowbatchstauName === "断奶预警配置") {
        Api = "pageQuerywean";
      } else if (this.nowbatchstauName === "配种&投放预警配置") {
        Api = "pageQuerytupping";
      } else {
        return;
      }
      // 查询表格数据
      nowpagereq[Api](params, {
        databaseName: this.organizationObj?.databaseName || 'DB_TDW1_PUBLIC',
        organizationNo: this.organizationObj.organizationNo || 'COMMON',
        breedTypeNo: 'sheep'
      }).then(async res => {
        this.loading = false;
        if (res.code === 1) {
          // this.$message.success("查询成功");
        } else {
          this.$message.error("查询失败");
        }
        let data = res.data;
        // 赋值总条数
        this.totalSize = data.totalElements;
        // 赋值数组
        this.tableData = data.content;
        if (Array.isArray(this.tableData) && this.tableData.length <= 0) {
          const { data } = await nowpagereq[Api]({}, {
        databaseName:  'DB_TDW1_PUBLIC',
        organizationNo:  'COMMON',
        breedTypeNo: 'sheep'
      })
          this.formDatas = data.content[0];
        }
        // this.addblankmet();
        this.resetActionBar();
        if (this.nowbatchstauName === "妊检预警配置") {
          if (data.content !== undefined && data.content.length > 0) {
            this.addActive = false;
          }
        } else if (this.nowbatchstauName === "产羔预警配置") {
          if (data.content !== undefined && data.content.length > 0) {
            this.addActive = false;
          }
        } else if (this.nowbatchstauName === "断奶预警配置") {
          if (data.content !== undefined && data.content.length > 0) {
            this.addActive = false;
          }
        } else if (this.nowbatchstauName === "配种&投放预警配置") {
          this.formData = data.content[0] || {};
          this.editActive = true;
          if (this.formData.tuppingWarningNo === undefined) {
            this.errorPAdd = true;
            this.addActive = true;
            this.editActive = false;
          } else {
            this.errorPAdd = false;
            this.errorPEdit = true;
            this.editActive = true;
          }
        }
      });
      // 判断搜索输入框数据
    },
    // 添加
    add() {
      this.canInput = true;
      this.nowChanceStau = 'add'
      this.formData = {
        ...this.formDatas, organizationNo: this.organizationObj.organizationNo,
        breedTypeNo: 'sheep'
      }
      this.titleText = "添加"
      this.dialogFormVisible = true;
      this.addActive = false;
      this.delActive = false;
      this.saveActive = true;
      this.cancelActive = true;
      this.editActive = false;
    },
    // 取消
    cancel(formData) {
      if (this.nowbatchstauName === "异常参数配置") {
        if (formData === "a") return;
      }
      this.deleteFlag = true;
      // console.log(this.nowChanceStau);
      // console.log(this.nowbatchstauName);
      if (this.nowbatchstauName === "异常参数配置") {
        this.nowChanceStau = "";
        this.getErrorPData();
        this.dialogFormVisible = false;
        return;
      } else {
        this.nowChanceStau = "";
        this.formData = {};
        this.dialogFormVisible = false;
        this.canInput = false;
        this.addActive = true;
        this.delActive = false;
        this.saveActive = false;
        this.cancelActive = false;
        this.editActive = true;
      }
      this.getTableDataList();

      if (this.nowbatchstauName === "妊检预警配置") {
        if (this.tableData !== undefined && this.tableData.length > 0) {
          this.addActive = false;
        }
      } else if (this.nowbatchstauName === "产羔预警配置") {
        if (this.tableData !== undefined && this.tableData.length > 0) {
          this.addActive = false;
        }
      } else if (this.nowbatchstauName === "断奶预警配置") {
        if (this.tableData !== undefined && this.tableData.length > 0) {
          this.addActive = false;
        }
      }
      // else if (this.nowbatchstauName === "测定预警配置") {
      // }
    },
    handleEdit(row) {
      // 外部气象站较特殊
      this.editlist = row;
      this.nowChanceStau = "edit";
    },
    handleSelectionChange(list) {
      this.nowSelectList = [];
      let notvalue = true;
      this.nowSelectList = list.map(item => {
        if (this.nowbatchstau === 0) {
          if (item.deviceDataItemMapperId) {
            return item.deviceDataItemMapperId;
          } else {
            notvalue = false;
            return "";
          }
        } else if (this.nowbatchstau === 1) {
          if (item.deviceCameraMapperId) {
            return item.deviceCameraMapperId;
          } else {
            notvalue = false;
            return "";
          }
        }
      });
      if (notvalue === false) {
        this.delActive = false;
        this.$message.warning("不可选择空数据！");
        return;
      }
      if (this.nowSelectList.length > 0) this.delActive = true;
      else this.delActive = false;
    },
    handleDelete(data) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        customClass: "myClass"
      })
        .then(() => {
          let del = "";
          if (this.nowbatchstauName === "防疫预警配置") {
            del = "deleqid";
          } else if (this.nowbatchstauName === "驱虫预警配置") {
            del = "deldewo";
          } else if (this.nowbatchstauName === "饲料预警配置") {
            del = "delfeed";
          } else if (this.nowbatchstauName === "妊检预警配置") {
            del = "delbree";
          } else if (this.nowbatchstauName === "产羔预警配置") {
            del = "dellamb";
          } else if (this.nowbatchstauName === "测定预警配置") {
            del = "delmeas";
          } else if (this.nowbatchstauName === "断奶预警配置") {
            del = "delwean";
          }
          nowpagereq[del](data, {
            databaseName: this.organizationObj?.databaseName,
            organizationNo: this.organizationObj.organizationNo,
            breedTypeNo: 'sheep'
          }).then(res => {
            if (res.code === 1) {
              this.$message.success("删除成功");
              this.getTableDataList();
            } else {
              this.$message.error("删除失败");
            }
          });
        })
        .catch(() => {
          //
          this.$message("取消删除");
        });
    },
    save(formData) {
      this.$refs[formData].validate(valid => {
        if (valid) {
          if (!this.organizationObj?.databaseName) return this.$message.warning("当前基地无databaseName");
          this.formData.deviceNo = this.deviceNo;
          // this.formData.organizationNo = sessionStorage.organizationNo;
          if (this.nowChanceStau === "add") {
            if (this.nowbatchstauName === "异常参数配置") {
              errorPApi.add(this.formData, {
                databaseName: this.organizationObj?.databaseName,
                organizationNo: this.organizationObj.organizationNo,
                breedTypeNo: 'sheep'
              }).then(res => {
                if (res.code === 1) {
                  this.$message.success(res.msg || "添加成功");
                  this.getErrorPData();
                  // 获取参数
                } else {
                  this.$message.error(res.msg || "添加失败");
                }
                this.dialogFormVisible = false;
              });
              return;
            }
            let formData = this.formData;
            let add = "";
            if (this.nowbatchstauName === "防疫预警配置") {
              add = "addeqid";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "驱虫预警配置") {
              add = "adddewo";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "妊检预警配置") {
              add = "addbree";
              formData = { ...this.formData };
            } else if (this.nowbatchstauName === "饲料预警配置") {
              add = "addfeed";
              formData = { ...this.formData };
            } else if (this.nowbatchstauName === "产羔预警配置") {
              add = "addlamb";
              formData = { ...this.formData };
            } else if (this.nowbatchstauName === "测定预警配置") {
              add = "addmeas";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "断奶预警配置") {
              add = "addwean";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "配种&投放预警配置") {
              add = "addtupping";
              formData = { ...this.formData };
            } else {
              return;
            }
            nowpagereq[add](formData, {
              databaseName: this.organizationObj?.databaseName,
              organizationNo: this.organizationObj.organizationNo,
              breedTypeNo: 'sheep'
            }).then(res => {
              if (res.code === 1) {
                this.$message.success("新增成功！");
                this.getTableDataList();
              } else {
                this.$message.error("新增失败！");
              }
            });
          } else if (this.nowChanceStau === "edit") {
            if (this.nowbatchstauName === "异常参数配置") {
              errorPApi.edit(this.formData, {
                databaseName: this.organizationObj?.databaseName,
                organizationNo: this.organizationObj.organizationNo,
                breedTypeNo: 'sheep'
              }).then(res => {
                if (res.code === 1) {
                  this.$message.success(res.msg || "修改成功");
                  this.getErrorPData();
                  // 获取参数
                } else {
                  this.$message.error(res.msg || "修改失败");
                }
                this.dialogFormVisible = false;
              });
              return;
            }
            let formData = this.formData;
            let edit = "";
            if (this.nowbatchstauName === "防疫预警配置") {
              edit = "editeqid";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "驱虫预警配置") {
              edit = "editdewo";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "饲料预警配置") {
              edit = "editfeed";
              formData = { ...this.formData };
            } else if (this.nowbatchstauName === "妊检预警配置") {
              edit = "editbree";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "产羔预警配置") {
              edit = "editlamb";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "测定预警配置") {
              edit = "editmeas";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "断奶预警配置") {
              edit = "editwean";
              formData = { cameraNoList: this.cameraNoList, ...this.formData };
            } else if (this.nowbatchstauName === "配种&投放预警配置") {
              edit = "edittupping";
              formData = { ...this.formData };
            } else {
              return;
            }
            nowpagereq[edit](formData, {
              databaseName: this.organizationObj?.databaseName,
              organizationNo: this.organizationObj.organizationNo,
              breedTypeNo: 'sheep'
            }).then(res => {
              if (res.code === 1) {
                this.$message.success("修改成功！");
                this.getTableDataList();
              } else {
                this.$message.error("修改失败！");
              }
            });
          }
        } else {
          return false;
        }
      });
    },
    // 循环过滤树形数组
    filterArrForKey(arr) {
      let newArr = [];
      newArr = arr?.map(item => {
        if (item.children) {
          item = {
            ...item,
            children: this.filterArrForKey(item.children)
          };
        }
        return item;
      });
      newArr = newArr?.filter(item => item != null);
      return newArr;
    }
  }
};
</script>

<style scoped lang="scss">
::v-deep {
  .el-form {
    display: block;
    // color: $activeCompanyMenuText;
  }

  .table-content {
    overflow-x: auto;
  }

  .table-box {
    // background-color: $actionBarBgColor;
    border: 1px solid #c7e3ff;
    border-radius: 5px;
    color: #000;

    .table-content {
      padding: 10px;
    }
  }
}

.box-info {
  display: flex;
  justify-content: center;
  align-content: center;
  width: 100%;
  height: 100%;
  align-items: center;
  font-size: 30px;
  color: rgba(172, 172, 172, 0.557);
}

::v-deep .el-dialog {
  margin-top: 15vh !important;
  width: 33% !important;

  .el-dialog__body {
    text-align: center;
    font-weight: 600;
    min-height: 40vh;
  }

  .el-dialog__footer {
    .Reconfirmation {
      background-color: #096f8f;
      border-radius: 6px;
      // color: $activeCompanyMenuText;
    }

    .correct {
      background-color: #fff;
      color: #096f8f;
      border-radius: 6px;
      border: 1px solid #096f8f;
    }
  }
}

::v-deep .el-table__header-wrapper .el-table-column--selection {
  border: 1px solid red;
  text-indent: -999999px;
  // display: n.line {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;

  .line-click {
    width: 30px;
    height: 30px;
    background-color: rgb(198, 196, 196);
    display: flex;
    justify-content: center;
    align-items: center;
    border: rgb(214, 214, 214) 1px solid;
    border-radius: 50%;
    margin-bottom: 10px;
    margin-top: 5px;
    margin-left: 5px;
    cursor: pointer;

    .el-icon-minus {
      color: white;
    }
  }
}

.line-click {
  width: 30px;
  height: 30px;
  background-color: rgb(198, 196, 196);
  display: flex;
  justify-content: center;
  align-items: center;
  border: rgb(214, 214, 214) 1px solid;
  border-radius: 50%;
  margin-bottom: 10px;
  margin-top: 5px;
  margin-left: 20px;
  position: absolute;
  right: 0;
  top: 0;
  cursor: pointer;

  .el-icon-plus {
    color: white;
  }
}

.line-clicks {
  width: 30px;
  height: 30px;
  // background-color: rgb(198, 196, 196);
  display: flex;
  justify-content: center;
  align-items: center;
  // border: rgb(214, 214, 214) 1px solid;
  color: red;
  border-radius: 50%;
  margin-bottom: 10px;
  margin-top: 5px;
  margin-left: 20px;
  text-decoration: underline;
  text-underline-position: under;
  position: relative;
  right: 0;
  top: 0;
  cursor: pointer;
}

::v-deep .el-form-item {
  .el-form-item {
    margin-bottom: 20px;
  }
}

::v-deep .el-dialog {
  .el-dialog__body {
    max-height: 65vh;
  }
}

::v-deep .check {
  .el-form-item__label {
    min-width: 240px !important;
  }
}

.addE {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  // padding: 0 2%;
}

.table-main {
  display: flex;
  flex-wrap: wrap;

  .table-main-item {
    width: 300px;
    height: 200px;
    box-shadow: 0px 0px 6px 1px rgba(0, 107, 211, 0.16);
    margin-right: 10px;
    padding: 5px;
    border-radius: 5px;
    position: relative;
    background-image: url("~@/assets/alert-condition-configuration/condition-bg.png");
    background-position: bottom right;
    background-repeat: no-repeat;

    .main-item-title {
      color: #3591eb;
      width: 100%;
      text-align: center;
      font-size: 18px;
      line-height: 28px;
      // background-clip: text;
      font-family: Source Han Sans CN-Bold, Source Han Sans CN;
      font-weight: bold;

      i {
        position: absolute;
        display: flex;
        width: 106px;
        height: 9px;
        background: #1b85eb;
        border-radius: 5px 5px 5px 5px;
        opacity: 1;
        top: -3px;
        left: 50%;
        transform: translateX(-50%);
      }

      // -webkit-background-clip: text;
      // -webkit-text-fill-color: transparent;
    }

    .main-item-mas {
      width: 100%;
      height: 70%;
      overflow-y: auto;
      padding: 10px;

      >div {
        width: 100%;
        height: 100%;

        >div {
          font-size: 15px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #fff;
          line-height: 20px;
          padding-left: 20px;
          background-image: url("~@/assets/alert-condition-configuration/i.png");
          background-position: left;
          background-repeat: no-repeat;
          background-size: 6% auto;
        }
      }
    }

    .editable {
      color: rgb(114, 249, 56);
      margin-left: 10px;
      text-decoration: underline;
      position: absolute;
      right: 45px;
      bottom: 0;
    }

    .deletable {
      color: red;
      margin-left: 10px;
      text-decoration: underline;
      position: absolute;
      right: 5px;
      bottom: 0;
    }
  }
}

::v-deep {
  .dates-picker {
    background: #fff;

    // body {
    .el-date-picker__header {
      .el-icon-d-arrow-left {
        display: none;
      }

      &:nth-child(2) {
        display: none;
      }

      .el-date-picker__header-label:nth-child(3) {
        display: none;
      }

      .el-icon-d-arrow-right {
        display: none;
      }
    }
  }

  // }
}

::v-deep {
  .el-input-number {
    width: 100%;
  }

  .el-input-group__append {
    min-width: 120px;
    overflow: hidden;
    text-align: center;
    padding: 0;
  }

  .el-divider__text {
    background-color: #fff;
  }
}

.el-form1 {
  ::v-deep .el-form-item__label {
    min-width: 290px !important;
    text-align: end;
    // color: $activeCompanyMenuText;
  }
}

::v-deep .errorP {
  width: 50%;

  .el-form1 {
    width: 100%;

    .errorEdit {
      margin-left: 200px;
    }
  }
}
</style>
